/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author TimoR
 */
@Entity
@Table(name = "tournament")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tournament.findAll", query = "SELECT t FROM Tournament t"),
    @NamedQuery(name = "Tournament.findById", query = "SELECT t FROM Tournament t WHERE t.id = :id"),
    @NamedQuery(name = "Tournament.findByGame", query = "SELECT t FROM Tournament t WHERE t.game = :game"),
    @NamedQuery(name = "Tournament.findByGametyp", query = "SELECT t FROM Tournament t WHERE t.gametyp = :gametyp"),
    @NamedQuery(name = "Tournament.findByTeam1", query = "SELECT t FROM Tournament t WHERE t.team1 = :team1"),
    @NamedQuery(name = "Tournament.findByTeam2", query = "SELECT t FROM Tournament t WHERE t.team2 = :team2"),
    @NamedQuery(name = "Tournament.findByScoreteam1", query = "SELECT t FROM Tournament t WHERE t.scoreteam1 = :scoreteam1"),
    @NamedQuery(name = "Tournament.findByScoreteam2", query = "SELECT t FROM Tournament t WHERE t.scoreteam2 = :scoreteam2")})
public class Tournament implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "game")
    private String game;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "gametyp")
    private String gametyp;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "team1")
    private String team1;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "team2")
    private String team2;
    @Basic(optional = false)
    @NotNull
    @Column(name = "scoreteam1")
    private int scoreteam1;
    @Basic(optional = false)
    @NotNull
    @Column(name = "scoreteam2")
    private int scoreteam2;

    public Tournament() {
    }

    public Tournament(Integer id) {
        this.id = id;
    }

    public Tournament(Integer id, String game, String gametyp, String team1, String team2, int scoreteam1, int scoreteam2) {
        this.id = id;
        this.game = game;
        this.gametyp = gametyp;
        this.team1 = team1;
        this.team2 = team2;
        this.scoreteam1 = scoreteam1;
        this.scoreteam2 = scoreteam2;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getGame() {
        return game;
    }

    public void setGame(String game) {
        this.game = game;
    }

    public String getGametyp() {
        return gametyp;
    }

    public void setGametyp(String gametyp) {
        this.gametyp = gametyp;
    }

    public String getTeam1() {
        return team1;
    }

    public void setTeam1(String team1) {
        this.team1 = team1;
    }

    public String getTeam2() {
        return team2;
    }

    public void setTeam2(String team2) {
        this.team2 = team2;
    }

    public int getScoreteam1() {
        return scoreteam1;
    }

    public void setScoreteam1(int scoreteam1) {
        this.scoreteam1 = scoreteam1;
    }

    public int getScoreteam2() {
        return scoreteam2;
    }

    public void setScoreteam2(int scoreteam2) {
        this.scoreteam2 = scoreteam2;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tournament)) {
            return false;
        }
        Tournament other = (Tournament) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Tournament[ id=" + id + " ]";
    }
    
}
